<?php
include_once "../header1.php";
?>
<script type="text/javascript">
function cleartbox()
{	
	document.getElementById("Sea_Sch").innerHTML="";
}
</script>
<script type="text/javascript">
function getHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
function showHint(str)
{
var xmlhttp;    
if (str=="")
  {
  document.getElementById("List").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("List").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","sch_names.php?q="+str,true);
xmlhttp.send();
}
function fill(val)
{
document.form1.SchName.value=val;
document.getElementById("List").innerHTML="";
}
</script>
<link rel="stylesheet" href="../css/datepicker.css" type="text/css" />
    <link rel="stylesheet" media="screen" type="text/css" href="../css/layout.css" />
  	<script type="text/javascript" src="../js/jquery.js"></script>
	<script type="text/javascript" src="../js/datepicker.js"></script>
    <script type="text/javascript" src="../js/eye.js"></script>
    <script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="../js/layout.js?ver=1.0.2"></script>
<script type="text/javascript">
function re_te()
{
var xmlhttp; 
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("tioptions").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","training_names.php",true);
xmlhttp.send();
}
function hide()
{
document.getElementById("tioptions").innerHTML="";
}

</script>
</head>
<body>
<?php
include_once ("../Login/databaseconnection.php");
if(!loggedin())
{
	require_once ("../index.php");
}
   
   else
{
$New_Role=$_POST['New_Role'];
$Role=$_POST['Role'];
$T_NIC_Number=$_GET['T_NIC_Number'];
$First_Name=$_GET['First_Name'];
$Last_Name=$_GET['Last_Name'];
$Appointment_Date=$_POST['Appointment_Date'];
$Res_Team=$_POST['Res_Team'];
$From_Date=$_POST['From_Date'];
$Date_Of_Birth=$_POST['Date_Of_Birth'];
$New_Specialised_In=$_POST['New_Specialised_In'];
$Training_Name=$_POST['Training_Name'];
$From_Date=$_POST['From_Date'];
$SchName=$_POST['SchName'];
$Gender=$_POST['Gender'];
$Nature_Of_Appointment=$_POST['Nature_Of_Appointment'];
$Service=$_POST['Service'];
$Specialised_In=$_POST['Specialised_In'];
$Professional_Qualifications=$_POST['Professional_Qualifications'];
$Achievements=$_POST['Achievements_Awards'];
$Achieve= mysql_real_escape_string($Achievements);
$Address=$_POST['Address'];
$Mobile_Tp_Number=$_POST['Mobile_Tp_Number'];
$Home_Tp_Number=$_POST['Home_Tp_Number'];
$Office_Tp_Number=$_POST['Office_Tp_Number'];
$Appointed_Subject=$_POST['Appointed_Subject'];

date_default_timezone_set("Europe/Paris");
$t_d=date("Y-m-d");
if($From_Date=="")
{
$From_Date=$t_d;
}
	$name=explode(",",$SchName);
    $nam=$name[0];
$tn=count($name);
for($i=1;$i<$tn;$i++)
{
if(empty($adr))
{
$adr=$name[$i];
}
else
{
$adr=$adr.",".$name[$i];
}
}
$results= mysql_query("SELECT * FROM school Where Name='$nam' AND Address='$adr'");
if($row = mysql_fetch_array($results))
{
 $School_Id=$row['School_Id'];
}
	date_default_timezone_set("Europe/Paris");
    $t_d=date("Y-m-d");
	if(isset($_POST['Register']))
	{
		$T_NIC_Number=$_POST['T_NIC_Number'];
 if($T_NIC_Number=="")
	   {
		  $_SESSION['errorin']="Please enter the NIC number,Indexed details are required!";
		   }
if($T_NIC_Number!="")
	   {
$Lab_Che=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$T_NIC_Number'");
if($rowl=mysql_fetch_array($Lab_Che))
		{
			$_SESSION['errorexi']="Sorry this Teacher's record already exists";
		}
		
		else
		{
		if($_SESSION['Access_Type']=="Teacher in Charge")
{
   $NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id'];
   if($Own_School_Id==$School_Id)
   {
   require_once 'reg.php';
   }
   else
	   {
	   $_SESSION['errornotallo']="Sorry you are not allowed to do this!";
	   }
   }
   }
   		else if($_SESSION['Access_Type']=="Administrator")
{

	require_once 'reg.php';
	}
	  else
	   {
	   $_SESSION['errornotallo']="Sorry you are not allowed to do this!";
	   }
	}
			}
		}
?>
 <?php
include_once "../header2.php";
?>
<?php
include_once "topmenu.php";
?>
<div id="content">
	<div id="main">
	  <div id="bodyfield">
<div id="lefttablereg">
<form action="#" method="POST" name="form1">
<table width="782" border="0" class="tablefontv">
  <tr>
    <td height="21" colspan="5" scope="row" class="err">   <?php
    if(isset($_POST['Register']))
{
	if(isset($_SESSION['errorin']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errorin'];
		unset($_SESSION['errorin']);
	}
	if(isset($_SESSION['error']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['error'];
		unset($_SESSION['error']);
	}
	if(isset($_SESSION['errorrt']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errorrt'];
		unset($_SESSION['errorrt']);
	}
	if(isset($_SESSION['errorexi']))
	{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
		echo $_SESSION['errorexi'];
		unset($_SESSION['errorexi']);
		
	}
	if(isset($_SESSION['errornotallo']))
{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['errornotallo'];
unset($_SESSION['errornotallo']);
}
if(isset($_SESSION['errordeg']))
{echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['errordeg'];
unset($_SESSION['errordeg']);
}
}?>
</td>
    <td width="191">&nbsp;</td>
  </tr>
  <tr>
    <td width="22" scope="row">&nbsp;</td>
    <td width="18" scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td width="176" height="25" scope="row">Firstname: </td>
	<?php
	if(isset($_POST['Register'])||isset($_GET['First_Name']))
{
if(isset($_GET['First_Name']))
{
$First_Name=$_GET['First_Name'];
}
echo '<td>';
echo "<input type='text' name='First_Name' value='$First_Name'/>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='First_Name'/>";
echo '</td>';

}?>
    <td width="306"></td>
    <td width="43">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td scope="row">&nbsp;</td>
    <td scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="25" scope="row">Lastname:</td>
	<?php
	   if(isset($_POST['Register'])||isset($_GET['Last_Name']))
{
if(isset($_GET['$Last_Name']))
{
$Last_Name=$_GET['$Last_Name'];
}
echo '<td>';
echo "<input type='text' name='Last_Name' value='$Last_Name'/>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='Last_Name'/>";
echo '</td>';

}?>
    <td></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  
  <tr>
    <td scope="row">&nbsp;</td>
    <td scope="row"><font color="red" size="+2">
      <p align="center">&nbsp;</p></font></td>
    <td height="25" scope="row">Role:</td>
	<td>
	<select name="Role" id="Role">
        <?php
		 if($Role!="")
	  {
	  echo '<option value="'.$Role.'">'.$Role.'</option>';
	  }
	  else
	  {
	  echo '<option value="Select One">Select One</option>';
	  }
$tea=mysql_query("SELECT DISTINCT(Role) FROM teacher");
	  
  while($row=mysql_fetch_array($tea))
  {
	 $R=$row['Role'];
if($R!=$Role)
{
	  echo '<option value="'.$R.'">'.$R.'</option>';
}
  }
	  ?>
      </select>
	  <font color="red">or </font><label>New role:</label>
	  <?php	 
 if($New_Role!="")
	  {
echo "<input type='text' name='New_Role' value='$New_Role'/>";
}
else{	  
echo "<input type='text' name='New_Role'/>";
}
	  ?>
	  </td>
    <td></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td scope="row">&nbsp;</td>
    <td scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="25" scope="row">NIC Number: </td>
	<?php
	   if(isset($_POST['Register'])||isset($_GET['T_NIC_Number']))
{
if(isset($_GET['$T_NIC_Number']))
{
$T_NIC_Number=$_GET['$T_NIC_Number'];
}
echo '<td>';
echo "<input type='text' name='T_NIC_Number' value='$T_NIC_Number'/>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='T_NIC_Number'/>";
echo '</td>';

}?>
    <td></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td scope="row">&nbsp;</td>
    <td scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td scope="row">Gender:</td>
    <td>
	<?php
	   if(isset($_POST['Register']))
{
	if($Gender=="Male")
	  {
	    echo '<input type="radio" name="Gender" value="Male" id="Gender_0" checked="checked" />';
	   echo "Male";
	  }
	  else
	  {
		  echo '<input type="radio" name="Gender" value="Male" id="Gender_0" />';
	   echo "Male";
	  }
        echo '<br />';
        if($Gender=="Female")
		{
          echo '<input type="radio" name="Gender" value="Female" id="Gender_1" checked="checked" />';
          echo "Female";
  }
  else
  {
	   echo '<input type="radio" name="Gender" value="Female" id="Gender_1" />';
          echo "Female";
  }
  }
  else
  {
  ?>
      <label>
        <input type="radio" name="Gender" value="Male" />
        Male</label>
      <br />
      <label>
        <input type="radio" name="Gender" value="Female" />
        Female</label>
      <?php
		}
		?>
    </td>
  </tr>
  <tr>
    <td scope="row">&nbsp;</td>
    <td scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="25" scope="row">Date of birth: </td>
	<?php
	   if(isset($_POST['Register']))
{
echo '<td>';
echo "<input type='text' name='Date_Of_Birth' value='$Date_Of_Birth' class='inputDate' id='inputDate'>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='Date_Of_Birth' value='$t_d' class='inputDate' id='inputDate'>";
echo '</td>';

}?>
    <td></td>
  
  </tr>
  <tr>
    <td scope="row">&nbsp;</td>
    <td scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="29" scope="row">School's Name:</td>
	
    <td>
    <?php
	 	 	if($_SESSION['Access_Type']=="Teacher in Charge")
{
	$NIC_Number=$_SESSION['NIC_Number'];
   $get_Sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$NIC_Number'");
   if($rowsch=mysql_fetch_array($get_Sch))
{
   $Own_School_Id=$rowsch['School_Id']; 
    $snam=mysql_query("SELECT * FROM school WHERE School_Id='$Own_School_Id'");
	  if($ros=mysql_fetch_array($snam))
	  {
	  $SchName=$ros['Name'].','.$ros['Address'];
	  }
}
	 echo "<input type='text' id='SchName' name='SchName' onKeyUp='showHint(this.value)' value='$SchName' onClick='cleartbox()' size='40' readonly='readonly'/>";
}
	else if($_SESSION['Access_Type']=="Administrator")
{
	    echo "<input type='text' id='SchName' name='SchName' onKeyUp='showHint(this.value)' value='$SchName' onClick='cleartbox()' size='40'/>";
}
	  ?>
	 </td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

<table width="962" height="61" border="0" class="tablefontv">
  <tr>
    <td width="43" scope="row">&nbsp;</td>
    <td width="10" scope="row"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td width="291" height="21" scope="row">Contact address: </td>

    <td colspan="3">	<?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Address' value='$Address'/>";


}
else
{

echo "<input type='text' name='Address'/>";


}?></td>
	
  </tr>
  <tr>
    <td scope="row">&nbsp;</td>
    <td scope="row">&nbsp;</td>
    <td height="21" scope="row">Telephone number: </td>
	
    <td width="168"><label>Home:
	<?php
	   if(isset($_POST['Register']))
{
echo '<td>';
echo "<input type='text' name='Home_Tp_Number' value='$Home_Tp_Number'/>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='Home_Tp_Number'/>";
echo '</td>';

}?>
  
    </label></td>
    <td width="185"><label>Work:
	<?php
	   if(isset($_POST['Register']))
{
echo '<td>';
echo "<input type='text' name='Office_Tp_Number' value='$Office_Tp_Number'/>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='Office_Tp_Number'/>";
echo '</td>';

}?>
    
    </label></td>
    <td width="242"><label>Cellular:
	<?php
	   if(isset($_POST['Register']))
{
echo '<td>';
echo "<input type='text' name='Mobile_Tp_Number' value='$Mobile_Tp_Number'/>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='Mobile_Tp_Number'/>";
echo '</td>';

}?>
    
    </label></td>
  </tr>
 </table>

<table width="1025" border="0" class="tablefontv">
  <tr>
    <td>&nbsp;</td>
    <td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="38">Nature of the appointment:</td>
    <td width="155"><?php
	   if(isset($_POST['Register']))
{

echo "<input type='text' name='Nature_Of_Appointment' value='$Nature_Of_Appointment'/>";


}
else
{

echo "<input type='text' name='Nature_Of_Appointment'/>";


}?></td>
  </tr>
  <tr>
    <td width="18">&nbsp;</td>
    <td width="11"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td width="192" height="26">Appointment Date:</td>
	<?php
	   if(isset($_POST['Register']))
{
echo '<td>';
echo "<input type='text' name='Appointment_Date' value='$Appointment_Date' class='inputDate1' id='inputDate1'>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='Appointment_Date' value='$t_d' class='inputDate1' id='inputDate1'>";
echo '</td>';

}?>
	<td width="147"></td>
    
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="27">Appointed Subject:</td>
    <?php
	   if(isset($_POST['Register']))
{
echo '<td>';
echo "<input type='text' name='Appointed_Subject' value='$Appointed_Subject'/>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='Appointed_Subject'/>";
echo '</td>';

}?>
    <td colspan="5">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td height="35">Achievements &amp; Awardes:</td>


    <td colspan="5"><textarea name="Achievements_Awards" cols="40" rows="3"><?php  if(isset($_POST['Register']))
{
echo $Achieve; 
}?></textarea></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>Resource team member:</td>
    <td>
	<?php
	   if(isset($_POST['Register']))
{
	if($Res_Team=="Yes")
	  {
		echo '<input type="radio" name="Res_Team" value="Yes" id="Res_Team_0" checked="checked"/>';
	   echo "Yes";
	  }
	  else
	  {
		  echo '<input type="radio" name="Res_Team" value="Yes" id="Res_Team_0"/>';
	   echo "Yes";
	  }
        echo '<br />';
        if($Res_Team=="No")
		{ 
		
          echo '<input type="radio" name="Res_Team" value="No" id="Res_Team_1" checked="checked"/>';
          echo "No";
  }
  else
  {
	   echo '<input type="radio" name="Res_Team" value="No" id="Res_Team_1"/>';
          echo "No";
  }
  }
  else
  {
  ?>
	<label>
	     <input type="radio" name="Res_Team" value="Yes" onClick="re_te()"/>
      Yes</label>
      <br />
      <label>
       <input type="radio" name="Res_Team" value="No" onClick="hide()"/>
        No</label>
		<?php
		}
		?></td>
         <?php
		$Res_Team=$_POST['Res_Team'];
		if($Res_Team=="Yes")
		{
    echo '<td width="162">';
	echo 'Training Id:';
	echo '</td>';
	echo '<td>';
	?>
	<select name="Training_Name" id="Training_Name">
        <?php
		if($Training_Name!="")
	  {
	  echo '<option value="'.$Training_Name.'">'.$Training_Name.'</option>';
	  }
	  else
	  {
	  echo '<option value="Select One">Select One</option>';
	  }
$tra=mysql_query("SELECT DISTINCT(Training_Name) FROM training");
	  
  while($row=mysql_fetch_array($tra))
  {
	 $Tra_Name=$row['Training_Name'];
if($Tra_Name!=$Training_Name)
{
	  echo '<option value="'.$Tra_Name.'">'.$Tra_Name.'</option>';
}
  }
	  ?>
      </select>
	  <?php
echo '</td>';		
	echo '<td width="130">';
    echo 'From Date:';
	echo '</td>';
	echo '<td>';
	if(isset($_POST['Register']))
{
echo "<input type='text' name='From_Date' value='$From_Date' class='inputDate2' id='inputDate2'/>";
}
else
{
echo "<input type='text' name='From_Date' class='inputDate2' value='$t_d' id='inputDate2'/>";
}
	
	echo '</td>';

  	}
		?>
    <td width="282"><div id="tioptions">	
  	</div></td>
       </tr>
  <tr>
    <td>&nbsp;</td>
    <td><font color="red" size="+2"><p align="center">*</p></font></td>
    <td height="24">Service:</td>
	<?php
	 if(isset($_POST['Register']))
{
echo '<td>';
echo "<input type='text' name='Service' value='$Service'/>";
echo '</td>';

}
else
{
echo '<td>';
echo "<input type='text' name='Service'/>";
echo '</td>';

}?>
    <td colspan="5"></td>
	
  </tr>
</table>
<table width="1057" border="0" class="tablefontv">
  <tr>
    <td width="12">&nbsp;</td>
    <td width="10"><font color="red" size="+2"><p align="center">*</p></font></td>
    <td width="405" height="53"><h3>Academic qualifications:</h3>
      <?php
if(isset($_POST['Register']))
{
if($A_Qua!="")
{
	 $acQua= explode(",",$A_Qua);
	 $ol="";
	 $al="";
	 $oac="";
	
for($i=0;$i<count($acQua);$i++)
{
if($acQua[$i]=='O/Level')
{
$ol="yes";
echo "<input type='checkbox' name='Academic_Qualifications[]' value='O/Level' checked='checked'/>";
  echo "O/Level";
   echo '<br/>';
  }   
  if($acQua[$i]=='A/Level')
  {$al="yes";
  echo "<input type='checkbox' name='Academic_Qualifications[]' value='A/Level' checked='checked'/>";
 echo "A/Level";
  echo '<br/>';
 }
 if($acQua[$i]!='O/Level'&&$acQua[$i]!='A/Level'&&$acQua[$i]!="")
  {
  $oac="yes";
    $ac=substr($acQua[$i],4);
	echo "<input type='checkbox' name='Academic_Qualifications[]' value='Degree_holder' checked='checked'/>";
echo "Degree holder,Subjects:";
echo '<br/>';
?>
      <textarea name='Academic_Qualifications_Deg' cols='40' rows='3'><?php echo $ac." "; ?></textarea>
      <?php
 echo '<br/>';
}
}
if($ol=="")
{
echo "<input type='checkbox' name='Academic_Qualifications[]' value='O/Level'/>";
  echo "O/Level";
  echo '<br/>';
}
if($al=="")
{
echo "<input type='checkbox' name='Academic_Qualifications[]' value='A/Level'/>";
 echo "A/Level";
   echo '<br/>';
}
if($oac=="")
{
echo "<input type='checkbox' name='Academic_Qualifications[]' value='Degree_holder'/>";
echo "Degree holder,Subjects:";
  echo '<br/>';
echo "<textarea name='Academic_Qualifications_Deg' cols='40' rows='3'></textarea>";
}
}
else
{
echo "<input type='checkbox' name='Academic_Qualifications[]' value='O/Level'/>";
  echo "O/Level";
  echo '<br/>';
echo "<input type='checkbox' name='Academic_Qualifications[]' value='A/Level'/>";
 echo "A/Level";
   echo '<br/>';
echo "<input type='checkbox' name='Academic_Qualifications[]' value='Degree_holder'/>";
echo "Degree holder,Subjects:";
  echo '<br/>';
echo "<textarea name='Academic_Qualifications_Deg' cols='40' rows='3'></textarea>";
}
}
else
{
echo "<input type='checkbox' name='Academic_Qualifications[]' value='O/Level' />";
  echo "O/Level";
 echo "<input type='checkbox' name='Academic_Qualifications[]' value='A/Level'/>";
 echo "A/Level";
echo "<input type='checkbox' name='Academic_Qualifications[]' value='Degree_holder'/>";
echo "Degree holder,Subjects:";
echo "<textarea name='Academic_Qualifications_Deg' cols='40' rows='3'></textarea>";
}
?></td>
    <td align="middle">
	<label>Specialised in:</label></td>
    <td width="500">
	<?php
$Spec_In=mysql_query("SELECT DISTINCT(Specialised_In) FROM teacher");	  
  while($row=mysql_fetch_array($Spec_In))
  {
$Spe_In=$row['Specialised_In'];
$splited_spe_In=explode(",",$Spe_In);
$All_Specia_In=explode(",",$Specia_In);
for($sp=0;$sp<count($splited_spe_In);$sp++)
{
$s_exists="";
for($spa=0;$spa<count($All_Specia_In);$spa++)
{
if($splited_spe_In[$sp]==$All_Specia_In[$spa])
{
$s_exists="yes";
break;
}
}
if($s_exists=="")
{
if(empty($Specia_In))
{
 $Specia_In=$splited_spe_In[$sp];
}
else
{
 $Specia_In=$Specia_In.",".$splited_spe_In[$sp];
}
}
}
}
	$allSpecia_In=explode(",",$Specia_In);
	$regSpecia_In=explode(",",$reg_Specia_In);
	if(isset($_POST['Register']))
	  {
for($s=0;$s<count($allSpecia_In);$s++)
{ 
$Spe_exists="";  
for($i=0;$i<count($regSpecia_In);$i++)
{		  
if($allSpecia_In[$s]==$regSpecia_In[$i])
{
$Spe_exists="yes";
  echo "<input type='checkbox' name='Specialised_In[]' value='$allSpecia_In[$s]' checked='checked'/>";
  echo $allSpecia_In[$s].'</br>';
  }
  }
  if($Spe_exists=="")
  {
  echo "<input type='checkbox' name='Specialised_In[]' value='$allSpecia_In[$s]'/>";
  echo $allSpecia_In[$s].'</br>';
  }
  }
  echo "<font color='red'>or</font> New";
  echo "<input type='text' name='New_Specialised_In' value='$New_Specialised_In'";
	  }
	  else
	  {
for($s=0;$s<count($allSpecia_In);$s++)
{	  
  echo "<input type='checkbox' name='Specialised_In[]' value='$allSpecia_In[$s]'/>";
  echo $allSpecia_In[$s].'</br>';
  }
  echo "<font color='red'>or</font> New";
  echo "<input type='text' name='New_Specialised_In'";
	  }
  ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td height="71"><br/>
      <h3>Profitional qualifications: </h3>
      <textarea name="Professional_Qualifications" cols="40" rows="3">
	  <?php  if(isset($_POST['Register']))
{
echo $Profe_Qualifications; 
}?>
      </textarea>
     </td>
    <td><a href="regtea.php" class="reset">Reset |</a>
      <input name="Register" type="submit" value="Register" class="buttonok"/>
     </td>
    <td>&nbsp;</td>
  </tr>
</table>
<br/>
<br/>
<br/>
 </form>
 </div>
 <div id="righttablereg">
<?php
 if($_SESSION['OK']!="OK")
{
?>
 <div class="suggestionListsch" id="List"></div>
<?php
}
  unset($_SESSION['OK']);
?>
</div>
</div>
</div>
</div>
<div id="sidebar"><br/>
<div id="partners" class="boxed">
			<h2 class="title">TEACHERS</h2>
            </div>
<?php
include_once "menu.php";
?>
<?php
include_once "../footer.php";
?>
<?php
}
?>
</body>
</html>